/**
 * Copyright 2012 Ricardo Engel
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.mookt.dcubed;

import java.io.Serializable;

/**
 * The aggregate root is the only member inside the aggregate boundary that
 * other objects outside the boundary are allowed to hold references to and
 * query on.
 * 
 * <p>
 * Aggregates are boundaries drawn around one or more entities which enforce
 * their invariants for any operation supported by the aggregate. The only point
 * of access for entities outside the aggregate is its <i>root</i> and is its
 * responsibility to:
 * <ul>
 * <li>Checking invariants of all entities within its boundary context.</li>
 * <li>Ensure that nothing outside the aggregate boundary holds a reference to
 * anything inside the boundary, except for the root itself. This can be done by
 * either (a) not exposing the aggregate internal structure or (b) providing
 * defensive copies of the internal entities.</li>
 * <li>Ensure that all entities in the aggregate root's boundary are removed
 * once the aggregate root is removed from the system.</li>
 * </ul>
 * For the outlined reasons, the aggregate roots are the only objects which may
 * have a {@link Repository} associated.
 * </p>
 * 
 * @author Ricardo Engel
 */
public interface AggregateRoot<ID extends Serializable> extends Entity<ID> {

}